package cn.edu.scau.dormitory_management_system.exception.pojo;

import cn.edu.scau.dormitory_management_system.enums.ExceptionMsgEnum;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

/**
 * @author djc
 * @date 2021/8/6
 * @time 18:32
 */

public class MyException extends RuntimeException{
    /**
     * 异常码
     */
    private int code;

    /**
     * 异常信息
     */
    private String message;

    public MyException(ExceptionMsgEnum msgEnum) {
        code = msgEnum.getCode();
        message = msgEnum.getMsg();
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    @Override
    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }
}
